<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
 <head>
    <title>编辑影人信息</title>
   <link rel="stylesheet" href="/admin/css/pintuer.css"/>
   <link rel="stylesheet" href="/admin/css/admin.css"/>
   <link  href="/admin/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css"/>
   <link href="/admin/css/bootstrap.min.css" rel="stylesheet" type="text/css" media="all" />
   <script src="/admin/js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
   <script src="/admin/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
   <script src="/admin/js/pintuer.js"></script>
    <style type="text/css">
    	.occupation-box {
    		border:1px solid #ddd; width:300px!important; height:100px; padding:20px;
    	}
    	.occupation-box > label {margin-right:22px;}
    </style>
    <script type="text/javascript" src="/admin/js/ajaxfileupload.js"></script>
    
    <script type="text/javascript">
    
    function ajaxFileUpload(id,ImgId) {
    	$.ajaxFileUpload({
    		url : '/file/upload/image',
    		secureuri : false,//当前URI是否是安全的 路径
    		fileElementId : id,//使用ID属性找到文件输入框
    		dataType : 'json',//服务器返回数据是什么格式
    		success : function(data, status) {
    			var isok=data.isok;
    			if(isok==1){
    				$(ImgId).attr("data-image","/file/image/"+data.filename);
    				$(ImgId).val(data.filename);
    				alert('上传成功');
    			}
    		},
    		error : function(data, status, e) {
    			alert('上传出错');
    		}
    	});
    	return false;
    }
    function ajaxFileUpload2(id) {
    	$.ajaxFileUpload({
    		url : '/file/upload/video',
    		secureuri : false,
    		fileElementId : id,
    		dataType : 'json',
    		success : function(data, status) {
    			var isok=data.isok;
    			if(isok==1){
    				$("#video1").attr("data-image","/file/image/"+data.filename);
    				$("#video1").val(data.filename);
    				alert("上传成功");
    			}
    		},
    		error : function(data, status, e) {
    			alert('上传出错');
    		}
    	});
    	return false;
    }
    function yanzheng(){
    	var name=$("#name").val();
    	var orderby=$("#orderby").val();
    	if($.trim(name)==""){
    		alert("名称不能为空");
    		return;
    	}
    	if($.trim(orderby)!=""&&isNaN(orderby)){
    		alert("顺序号必须为数字");
    		return;
    	}
    	$("#form").submit();
    }
    
    </script> 
</head>
<body>
<div class="panel admin-panel">
  <div class="panel-head"><strong><span class="icon-pencil-square-o"></span>&nbsp;影人信息</strong></div>
  <div class="body-content">
    <form method="post" class="form-x" action="/admin/maker/updateoradd" id="form">
      <div class="form-group">
        <div class="label">
          <label>演员姓名：</label>
        </div>
        <div class="field">
          <input type="text" class="input" name="name" th:value="${maker!=null?maker.name:''}" size="100" id="name"/>
           <input type="hidden" name="id" th:value="${maker!=null ? maker.id:''}"/>
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>性别：</label>
        </div>
        <div class="field">
          <label>
            <input type="radio"  name="sex" value="男" th:checked="${maker!=null and maker.sex=='男'}">男
          </label>
          <label>
            <input type="radio"  name="sex" value="女" th:checked="${maker!=null and maker.sex=='女'}">女
          </label>
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>生日：</label>
        </div>
        <div class="field">
          <input type="date" name="birthday" class="input"  th:value="${maker!=null ? #dates.format(maker.birthday,'yyyy-MM-dd'): ''}" />
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>出生地(国籍)：</label>
        </div>
        <div class="field">
          <input type="text" class="input" name="birthPlace" th:value="${maker!=null ? maker.birthPlace : ''}" size="100" id="name"/>
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>职业：</label>
        </div>
        <div class="field">
          <label th:each="occu:${occuList}" th:object="${occu}">
            <input type="checkbox" name="occupation" th:value="*{name}" th:checked="${maker!=null and #strings.contains(maker.occupation,occu.name)}">
            <span th:text="*{name}"></span>
          </label>
<!--          <label>-->
<!--            <input type="checkbox" name="occupation" value="导演" th:checked="${maker!=null and #strings.contains(maker.occupation,'导演')}"/>导演-->
<!--          </label>-->
<!--          <label>-->
<!--            <input type="checkbox" name="occupation" value="主角" th:checked="${maker!=null and #strings.contains(maker.occupation,'主角')}"/>主角-->
<!--          </label>-->
<!--          <label>-->
<!--          <input type="checkbox" name="occupation" value="制片人" th:checked="${maker!=null and #strings.contains(maker.occupation,'制片人')}"/>制片人-->
<!--        </label>-->
<!--          <label>-->
<!--            <input type="checkbox" name="occupation" value="后期制作" th:checked="${maker!=null and #strings.contains(maker.occupation,'后期制作')}"/>后期制作-->
<!--          </label>-->
<!--          <label>-->
<!--            <input type="checkbox" name="occupation" value="道具" th:checked="${maker!=null and #strings.contains(maker.occupation,'道具')}"/>道具-->
<!--          </label>-->
          <div class="tips"></div>
        </div>
      </div>

      
      <div class="form-group">
        <div class="label">
          <label>头像：</label>
        </div>
        <div class="field">
          <input type="text" id="img1" name="pic1" class="input tips" style="width:35%; float:left;" th:value="${maker!=null ? maker.pic1: ''}"
                 data-toggle="hover" data-place="right"  th:data-image="'/file/image/'+${maker!=null?maker.pic1:'default.jpg'}" readonly="readonly" />
          <input type="file"  id="file1" name="file" onchange="ajaxFileUpload('file1','#img1')"/>
          <!-- <input type="button" class="button bg-blue margin-left" id="image1" value="+ 浏览上传" onclick="ajaxFileUpload('file')" /> -->
        </div>
      </div>

      <div class="form-group">
        <div class="label">
          <label>个人简介：</label>
        </div>
        <div class="field">
        <textarea style="height: 200px; width: 500px;" class="input" name="briefIntro" th:text="${maker!=null ? maker.briefIntro:''}"></textarea>
          <!-- <div class="tips">如为空则按顺序排列</div> -->
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label></label>
        </div>
        <div class="field">
          <button class="button border-main icon-check-square-o" type="submit"> 提交</button>
          <button class="button border-red icon-tags" type="button" onclick="window.history.go(-1);"> 返回</button>
        </div>
      </div>
    </form>
  </div>
</div>
</body>
</html>